<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use App\Common\Tools\ImageUrl;

class UserInfo extends Model
{
    protected $primaryKey = 'user_id';
    protected $table = 'user_infos';
    protected $guarded = [];

    public function user()
    {
        return $this->hasOne('App\Models\User', 'id', 'user_id');
    }

    public function getHeadImageAttribute($url)
    {
        return ImageUrl::make($url);
    }
}
